import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/adoptdetail',
    name: 'AdoptDetail',
    component: () => import('../views/AdoptDetail.vue'),
  },
    {
    path: '/',
    redirect: '/home/index'
  },
  {
    path: '/home',
    name: 'home',
    component: HomeView,
    redirect: '/home/index',
    children:[{
      path: 'index',
      name: '/home/index',
      component: () => import('../views/IndexView.vue'), 
      meta: {  
      keepAlive: true }
      },{
      path: 'knowledge',
      name: '/home/knowledge',
      component: () => import('../views/Knowledge.vue')
    }]
  },
  {
    path: '/about',
    name: 'about',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  },
  {
    path:'/login',
    name: 'login',
    component:()=>import('../views/LoginView.vue')
  },
  {
    path:'/register',
    name: 'register',
    component:()=>import('../views/RegisterView.vue')
  },
  {
    path:'/address-list',
    name: 'address-list',
    component:()=>import('../views/AddressList.vue')
  },{
    path:'/address-edit',
    name: 'address-edit',
    component:()=>import('../views/AddressEdit.vue')
  },
  ,{
    path:'/me',
    name: 'me',
    component:()=>import('../views/Me.vue')
  }

]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
